//
//  setUpTool.m
//  FoodCorner
//
//  Created by lanou3g on 16/3/2.
//  Copyright © 2016年 zhangchao. All rights reserved.
//

#import "setUpTool.h"
#import "setUpModel.h"


#define leftImage @"account-icon"
#define rightImage @"accessorArrow-icon"
#define backImage @"setting-list-bg"
@implementation setUpTool

static setUpTool *tool;
+(instancetype)allocWithZone:(struct _NSZone *)zone
{
    
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        tool = [super allocWithZone:zone];
    });
    return tool;
    
    
}

//懒加载数组
- (NSMutableArray *)array_main{
    
    if (_array_main == nil) {
        //初始化数组
        self.array_main = [NSMutableArray array];
        //设置主界面数组
        [self setSetMainFaceGroup];
    }
    
    return _array_main;
}

/**
 将每个cell上的内容封装成model  这个cell里面有
 */
- (setUpModel *)dictWithArray:(NSMutableArray *)arrayCell
{
    
    
    setUpModel *model_cell = [[setUpModel alloc] init];
    model_cell.backImagV_image = [UIImage imageNamed:backImage];
    model_cell.leftImagV_image = [UIImage imageNamed:arrayCell[1]];
    model_cell.rightImagV = [UIImage imageNamed:arrayCell[2]];
    model_cell.lab_text = arrayCell[3];
    model_cell.rowHegit = [[arrayCell lastObject] floatValue];
    
    model_cell.hiddenL = !model_cell.leftImagV_image;
    model_cell.hiddenR = !model_cell.rightImagV;
    return model_cell;
}


#pragma mark================设置主界面的代码
/** 给数组里面添加分组信息===========test*/
- (void)setSetMainFaceGroup
{
    
    [self Group:@[@"user",@"set",@"about_beibei",@"message"]];
    
}
/**
 获得数组里的Value值为上面方法服务
 */
- (void)Group:(NSArray *)groupArray
{
    
    for (int i = 0; i < groupArray.count; i++) {
        if (i==0) {
            
            NSMutableArray *array = [NSMutableArray array];
            setUpModel *model_cel1 = [self dictWithArray:@[@"",@"",rightImage,@"手机用户2148",@"100"].mutableCopy];
            [array addObject:model_cel1];
            [_array_main addObject:array];
            
        }
        if (i==1){
            NSMutableArray *array = [NSMutableArray array];
            setUpModel *model_cel1 = [self dictWithArray:@[@"",leftImage,rightImage,@"账号管理",@"44"].mutableCopy];
            setUpModel *model_cel2 = [self dictWithArray:@[@"",leftImage,rightImage,@"设置密码",@"44"].mutableCopy];
             setUpModel *model_cel3 = [self dictWithArray:@[@"",leftImage,rightImage,@"收货地址",@"44"].mutableCopy];
             setUpModel *model_cel4 = [self dictWithArray:@[@"",leftImage,rightImage,@"发现好友",@"44"].mutableCopy];
            
            [array addObject:model_cel1];
            [array addObject:model_cel2];
            [array addObject:model_cel3];
            [array addObject:model_cel4];
            
            [_array_main addObject:array];
            
        }
        if (i==2) {
            NSMutableArray *array = [NSMutableArray array];
            setUpModel *model_cel1 = [self dictWithArray:@[@"0",@"",rightImage,@"消息推送",@"50"].mutableCopy];
          
            [array addObject:model_cel1];
           
            [_array_main addObject:array];
            
            
        }
        if (i==3) {
            NSMutableArray *array = [NSMutableArray array];
            setUpModel *model_cel1 = [self dictWithArray:@[@"0",@"",rightImage,@"把下厨房告诉朋友",@"50"].mutableCopy];
            setUpModel *model_cel2 = [self dictWithArray:@[@"0",@"",rightImage,@"帮助下厨房评分",@"50"].mutableCopy];
            
            [array addObject:model_cel1];
            [array addObject:model_cel2];
            
            [_array_main addObject:array];
            

        }
        
    }
    
}




@end
